package com.skplanet.rade.dao;

import org.hibernate.Criteria;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.skplanet.rade.domain.Story;
import com.skplanet.rade.domain.StoryTag;
import com.skplanet.rade.repository.hibernate.HibernateGenericRepository;

@Repository(value="storyTagDAO")
public class StoryTagDAO extends HibernateGenericRepository<StoryTag> {
	public boolean rowExists(String column, String data) {
		Criteria criteria = getCriteria();
		criteria.setProjection(Projections.property(column));
		criteria.add(Restrictions.eq(column, data));
		
		String retData = (String) criteria.uniqueResult();
		if( retData == null  || retData == "" ) {
			getCurrentSession().clear();
			return false;
		}else{
			getCurrentSession().clear();
			return true;
		}
	}
}
